﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SMS
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private ConfigDatabaseForm ObjConfigDataBaseForm;
        public void setObjConfigDataBaseForm(ConfigDatabaseForm obj)
        {
            ObjConfigDataBaseForm = obj;
        }
        private void configConnectDataBaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ObjConfigDataBaseForm == null)
            {
                ObjConfigDataBaseForm = new ConfigDatabaseForm();
                ObjConfigDataBaseForm.MdiParent = this;
                ObjConfigDataBaseForm.Show();
            }
            ObjConfigDataBaseForm.Select();
        }

        private frmConfigConnectDevice ObjConfigDeviceForm;
        public void setObjConfigDeviceForm(frmConfigConnectDevice obj)
        {
            ObjConfigDeviceForm = obj;
        }
        private void configDeviceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ObjConfigDeviceForm == null)
            {
                ObjConfigDeviceForm = new frmConfigConnectDevice();
                ObjConfigDeviceForm.MdiParent = this;
                ObjConfigDeviceForm.Show();
            }
            ObjConfigDeviceForm.Select();
        }

        private void hideTrayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
            this.Hide();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (System.Windows.Forms.MessageBox.Show(this, "Bạn có muốn thoát khỏi chương trình SMS DRM?", "Xác nhận", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                this.Dispose();
                Application.Exit();
            }
        }

        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (System.Windows.Forms.MessageBox.Show(this, "Bạn có muốn thoát khỏi chương trình SMS DRM?", "Xác nhận", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                this.Dispose();
                Application.Exit();
            }
            else
            {
                e.Cancel = true;
            }
        }

        private void notifyIconTray_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            this.Show();
            this.WindowState = FormWindowState.Maximized;
        }

        private void displayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Show();
            this.WindowState = FormWindowState.Maximized;
        }
       
    }
}
